﻿# Author: Mikael Svenson (@mikaelsvenson)
# Creation Date: 2/22/2011
$FASTSEARCH = [environment]::GetEnvironmentVariable("FASTSEARCH","Machine")
if( $FASTSEARCH -ne "" )
{
	Write-Host "Loading FAST Enviroment"
	$loaded = Get-PSSnapin -Name "AdminSnapIn" -erroraction silentlycontinue
	if( $loaded -eq $null )
	{
		Add-PSSnapin AdminSnapIn
		Write-Host "Loading AdminSnapIn"
	}
	$loaded = Get-PSSnapin -Name "Microsoft.FASTSearch.PowerShell" -erroraction silentlycontinue
	if( $loaded -eq $null )
	{
		Add-PSSnapin Microsoft.FASTSearch.PowerShell
		Write-Host "Loading Microsoft.FASTSearch.PowerShell"
	}
	$loaded = Get-Module -Name "Community.SharePoint.FAST.PowerShell" -erroraction silentlycontinue
	if ( $loaded -eq $null )
	{
		Import-Module ./Community.SharePoint.FAST.PowerShell.dll
		Write-Host "Loading Community.SharePoint.FAST.PowerShell.dll"
	}
}

$SHAREPOINT = "hklm:\software\microsoft\shared tools\web server extensions\14.0\wss\installedproducts"
if( Test-Path $SHAREPOINT )
{
	Write-Host "Loading SharePoint Enviroment"
	$loaded = Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -erroraction silentlycontinue
	if( $loaded -eq $null )
	{
		Add-PSSnapin Microsoft.SharePoint.PowerShell
		Write-Host "Loading Microsoft.SharePoint.PowerShell"
	}
	$loaded = Get-Module -Name "Community.SharePoint.PowerShell" -erroraction silentlycontinue
	if( $loaded -eq $null )
	{
		Import-Module ./Community.SharePoint.PowerShell
		Write-Host "Loading Community.SharePoint.PowerShell"
	}
	
}
